[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
if                           if Statement

    The if  and else  keywords provide  for executing  one of  possibly two
    statements conditioned upon  the TRUE or  FALSE value of  an expression
    list.  The form of the 'if'/'else' statement is:

                     if ( expression_list ) statement1

    or

           if ( expression_list ) statement1 else statement2

    If  expression_list,  when  evaluated,  produces  a  TRUE  value   then
    statement1 is executed.  If the expression_list produces a FALSE value,
    then for the second form, statement2 is executed.

    Notes:  The parentheses are required around expression_list

  -------------------------------- Example ---------------------------------

           if ( i < 4 )
               process(SMALL);
           else if ( i < 10 )
               process(MEDIUM);

    An else always  belongs to the  most recent if,  so the second  else in
    this next example, else process(LARGE), belongs to:  if (i < 10).

           if ( i < 4 )
               process(SMALL);
           else if ( i < 10 )
               process(MEDIUM);
           else
               process(LARGE);

See Also: else
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson